package views;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;

import utils.ImageUtil;
import views.button.NoobButton;


public class WelcomeView extends View implements ActionListener{
	private NoobButton start ;
	private NoobButton exit ;
	public WelcomeView(MainFrame mf,int width, int height){
		super(mf,width,height);
		start = new NoobButton("Start");
		exit = new NoobButton(" Exit ");
		start.setForeground(Color.white);
		exit.setForeground(Color.white);
		start.setActionCommand("start");
		exit.setActionCommand("exit");
		start.addActionListener(this);
		exit.addActionListener(this);
		Box vBox = Box.createVerticalBox();
		vBox.add(Box.createRigidArea(new Dimension(0,100)));
		vBox.add(start);
		vBox.add(Box.createRigidArea(new Dimension(0,20)));
		vBox.add(exit);
		this.add(vBox);
	}
	public void paintComponent(Graphics g){
		super.paintComponent(g);
		new ImageIcon(WelcomeView.class.getResource("/images/bg.jpg")).paintIcon(this,g, 0, 0);
	}
	public void actionPerformed(ActionEvent e){
		String cmd = e.getActionCommand();
		if("start".equals(cmd)){
			mf.cardLayout.show(mf.getContentPane(),MainFrame.GAME);
			mf.gameView.resizeWindow();
		}else{
			System.exit(0);
		}
	}
}
